package com.itheima.day06.test7;

import java.util.*;

public class Test7 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Map<Product,Integer> map = new HashMap<Product, Integer>();

        while (true) {
            System.out.println("输入店铺名称,end终止");
            String storeName = sc.next();
            if ("end".equals(storeName)) {
                break;
            }

            System.out.println("输入商品名称");
            String productName = sc.next();
            Product product = new Product(storeName, productName);

            if (map.containsKey(product)) {
                map.put(product,map.get(product)+1);
            }else {
                map.put(product,1);
            }
        }

        System.out.println("购物车内商品:");
        System.out.println(map);


    }
}
